import java.util.Scanner;

public class Job04 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        boolean b= false;
        int amount = 100;
        char JX = ' ';
        System.out.println("ATM  取款机");
        for (int i = 1;i <= 3;i++){
            System.out.print("请输入密码:");
            String Password = input.next();
            while (!b){
                if (Password.equals("111111")){
                    do {
                        System.out.print("请输入取款金额:");
                        amount = input.nextInt();
                        if ((amount % 100 == 0) && (amount < 1000)) {
                            System.out.println("交易成功余额:" + amount + "元,请取卡!");
                            System.exit(0);
                        }else{
                            System.err.print("是否请重新输入金额:(N/Y):");
                            JX = input.next().charAt(0);
                        }
                    }while (JX == 'Y' || JX == 'y');
                    break;
                } else {
                    System.err.println("密码错误!");
                    b = true;
                    break;
                }
            }
            if (!b){
                break;
            }
            b = false;
        }
        System.out.println("结束交易!");
    }
}
